package ControlLayer;
import ModelLayer.Sale;
import ModelLayer.SalesLine;
import DBLayer.IFDBSale;
import DBLayer.DBSale;
import java.util.ArrayList;

public class CtrSale 
{
    private IFDBSale dbSale = new DBSale();
    private CtrSalesLine ctrSalesLine = new CtrSalesLine();
    
     public ArrayList getAllSales()
    {
      ArrayList allSale = new ArrayList();
      allSale = dbSale.getAllSales(false);
      return allSale;
    }
   
    
    public Sale findSale(int SaleID) 
    {
	return dbSale.findSale(SaleID, true);
    }
    
    public Sale findLatestSale()
    {
        return dbSale.findLatestSale(false);
    }

    public Sale searchSaleID(int saleID)
    {
        return dbSale.searchSaleID(saleID, true);
    }
 
    public void insertSale(Sale saleObj) 
    {
        dbSale.insertSale(saleObj);
    }
 
    public int MAXID()
    {
       int id = dbSale.MaxID();
       return id;
    }
    
    public ArrayList<Sale> Sales(int saleID)
    {
        return dbSale.Sales(saleID);
    }
    
}
